<?php
		$result=array();
		foreach($ciucourses as $key => $arr1){	
		    foreach($arr1 as $key2 => $val2){
				if($key2=="CiucourseCiustudent"){
				$result[]=$val2;
				}
			}
		}
?>


<div class="ciucourses contenidofijo">
  <h2><?php __('Cursos anteriores');?></h2>
    
  <?php if(isset($language_list)){ ?>
  <?php 
    foreach($language_list as $key =>$val){
      echo "<div class='button'>";
      echo $this->Html->link(__($val, true), array('action' => 'index', $key));
      echo "</div>";
    }
  ?>
  <?php } ?>
  
  <table class="zebra" cellpadding="0" cellspacing="0">
  <thead>
  <tr>
      <th><?php echo $this->Paginator->sort('id');?></th>
      <th><?php echo $this->Paginator->sort('ciulanguage_id');?></th>
      <th><?php echo $this->Paginator->sort('ciutimetable_id');?></th>
      <th><?php echo $this->Paginator->sort('ciuroom_id');?></th>
      <th><?php echo $this->Paginator->sort('ciucoursestate_id');?></th>
      
	  <th><?php echo $this->Paginator->sort('Inscrito' );?></th>
      <th class="actions"><?php __('Actions');?></th>
  </tr>
  </thead>
  <tbody>
  <?php
  $i = 0;
  foreach ($ciucourses['CiucourseCiustudent'] as $ciucourse):
    $class = null;
    if ($i++ % 2 == 0) {
      $class = ' class="altrow"';
    }
  ?>
  <tr<?php echo $class;?>>
    <td><?php echo $ciucourse['Ciucourse']['id']; ?>&nbsp;</td>
    <td>
      <?php echo $ciucourse['Ciusubject']['name']; ?>
    </td>
    <td>
      <?php echo $ciucourse['CiucourseCiustudent']['total_score']; ?>
    </td>
    <td>
      <?php echo $ciucourse['Ciucurspersstate']['name']; ?>
    </td>
    <td>
      <?php echo $ciucourse['Ciucoursestate']['name']; ?>
    </td>
    <td>
	  <?php if( in_array( $ciucourse['Ciucourse']['id'], array_keys($owncourses) )  ){  ?>
	  <?php  echo __( $ciucurspersstates[ $owncourses[  $ciucourse['Ciucourse']['id'] ]] ) ; ?>
      <?php }else{ ?>
	  
	  <?php } ?>
	</td>
    <td class="actions">
      <?php echo $this->Html->link(__('Preregister', true), array('action' => 'preregister', $ciucourse['Ciucourse']['id'])); ?>
    </td>
  </tr>
<?php endforeach; ?>
</tbody>
  </table>
  <p>
  <?php
  echo $this->Paginator->counter(array(
  'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
  ));
  ?>  </p>

  <div class="paging">
    <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
 |  <?php echo $this->Paginator->numbers();?>
 |
    <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
  </div>
</div>

